package com.itheima.subway.info.manage.controller;

import com.itheima.subway.info.manage.service.AddService;
import com.itheima.subway.info.manage.service.CheckService;

import java.util.Scanner;

public class AddController {

    public static void addSubways() {
    Scanner sc = new Scanner(System.in);
        while (true) {
            System.out.println("请输入您要添加的地铁站：");
            String next = sc.next();

            boolean exists = CheckService.isExists(next);

            if (!exists) {
                System.out.println("请输入地铁站编号：");
                String subId = sc.next();
                System.out.println("请输入几号地铁线路：");
                String line = sc.next();
                AddService.addSubway(subId,next,line);

            } else {
                System.out.println("您输入的地铁站已存在，请重新输入！");
                break;
            }
    }
}
}
